﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/MasterPage/Site1.Master" AutoEventWireup="true" CodeBehind="DeliveryManager.aspx.cs" Inherits="TARS.AdminCP.Delivery" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <div>
            <telerik:RadSkinManager ID="Metro" runat="server" Skin="Hay" />
            <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="true" />
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" Width="100%">
                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="btnShow">
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="btnUpdate">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelCssClass="" />
                                <telerik:AjaxUpdatedControl ControlID="DeliveryInfoPnael" UpdatePanelCssClass="" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:RadAjaxManager>
                <label for="NamesDDL"><b>Filter:</b></label>
                <div style="margin-top: 5px; margin-bottom: 15px;">
                    <telerik:RadComboBox Width="250px" DataTextField="ZoneName" DataValueField="ID" EnableLoadOnDemand="True" ID="cboFilterBranchesZone" runat="server" Skin="Metro" AutoPostBack="True"
                        OnSelectedIndexChanged="cboFilterBranchesZone_SelectedIndexChanged">
                    </telerik:RadComboBox>
                    <br />
                    <telerik:RadComboBox Width="250px" DataTextField="CarrierTypeName" DataValueField="ID" EnableLoadOnDemand="True" ID="cboFilterCarrierTypeName" runat="server" Skin="Metro" AutoPostBack="true" Enabled="False" OnSelectedIndexChanged="cboFilterCarrierTypeName_SelectedIndexChanged"></telerik:RadComboBox>
                    <br />
                    <telerik:RadButton ID="btnShow" OnClick="btnShow_Click" AutoPostBack="true" Skin="Metro" Width="200px" Enabled="false" runat="server" Text="Show"></telerik:RadButton>
                </div>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TARS_DeliveryConnectionString %>" SelectCommand="SELECT [DeliveryStatus], [CreatedTime], [DeliveryMasterID], [ID] FROM [t_DeliveryStatus] WHERE ([DeliveryMasterID] = @DeliveryMasterID)">
                    <SelectParameters>
                        <asp:Parameter Name="DeliveryMasterID" Type="Object" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <telerik:RadGrid ID="RadGrid1" Width="100%" Visible="False"
                    runat="server" AllowFilteringByColumn="True" AllowPaging="True" EnableLinqExpressions="False"
                    AllowSorting="True" CellSpacing="0" GridLines="None" Skin="Hay" DataSourceID="SqlDataSource3" OnItemCommand="RadGrid1_ItemCommand" AutoGenerateColumns="False">
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                        <Resizing AllowColumnResize="True" AllowResizeToFit="True" AllowRowResize="True" ResizeGridOnColumnResize="True" />
                    </ClientSettings>
                    <MasterTableView FilterExpression="([Active] = True)" CommandItemDisplay="TopAndBottom" DataKeyNames="NewID" DataSourceID="SqlDataSource3">
                        <CommandItemSettings ExportToPdfText="Export to PDF" ShowAddNewRecordButton="False" />
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn DataField="NewID" FilterControlAltText="Filter NewID column" HeaderText="NewID" SortExpression="NewID" UniqueName="NewID" DataType="System.Guid" ReadOnly="True" Visible="False">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Branches_Name" FilterControlAltText="Filter Branches_Name column" HeaderText="Branches Name" SortExpression="Branches_Name" UniqueName="Branches_Name">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DropZoneName" FilterControlAltText="Filter DropZoneName column" HeaderText="Drop Zone Name" SortExpression="DropZoneName" UniqueName="DropZoneName">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="WeightTypeName" FilterControlAltText="Filter WeightTypeName column" HeaderText="Weight Type Name" SortExpression="WeightTypeName" UniqueName="WeightTypeName">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Prices" FilterControlAltText="Filter Prices column" HeaderText="Prices" SortExpression="Prices" UniqueName="Prices">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="TotalWeight" DataType="System.Double" FilterControlAltText="Filter TotalWeight column" HeaderText="Total Weight" SortExpression="TotalWeight" UniqueName="TotalWeight">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="TotalMoney" DataType="System.Decimal" FilterControlAltText="Filter TotalMoney column" HeaderText="Total Money" SortExpression="TotalMoney" UniqueName="TotalMoney">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ScretNumber" DataType="System.Guid" FilterControlAltText="Filter ScretNumber column" HeaderText="Scret Number" SortExpression="ScretNumber" UniqueName="ScretNumber">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridCheckBoxColumn DataField="Active" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" CurrentFilterValue="true" DataType="System.Boolean" FilterControlAltText="Filter Active column" HeaderText="Active" SortExpression="Active" UniqueName="Active">
                            </telerik:GridCheckBoxColumn>
                            <telerik:GridBoundColumn DataField="CreatedTime" DataType="System.DateTime" FilterControlAltText="Filter CreatedTime column" HeaderText="Created Time" SortExpression="CreatedTime" UniqueName="CreatedTime">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                        <EditItemStyle BackColor="LightGreen" />
                        <PagerStyle PageSizeControlType="RadComboBox" />
                    </MasterTableView>
                    <PagerStyle Mode="NextPrevNumericAndAdvanced" PageSizeControlType="RadComboBox" />
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>
                </telerik:RadGrid>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:TARS_DeliveryConnectionString %>" SelectCommand="SELECT NewID FROM [v_DeliveryManager] Where NewID = null"></asp:SqlDataSource>
                <div style="margin-top: 5px; margin-bottom: 15px;">
                    <telerik:RadButton ID="btnViewDelivery" Visible="false" AutoPostBack="true" Skin="Metro" Width="200px" runat="server" Text="View Delivery" OnClick="btnViewDelivery_Click"></telerik:RadButton>
                </div>

                <telerik:RadAjaxPanel ID="DeliveryInfoPnael" Visible="false" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" Width="100%">
                    <table style="width: 100%;">
                        <tr>
                            <td class="auto-style2">
                                <fieldset style="width: 100%; background: white;">
                                    <legend>
                                        <asp:Label ID="Label2" runat="server" Text="Customer Info" Font-Size="Large"></asp:Label></legend>
                                    <table>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label1" runat="server" Text="F.Name:"></asp:Label>
                                            </td>
                                            <td class="auto-style4">

                                                <telerik:RadTextBox ID="txtCustomerFName" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label3" runat="server" Text="L.Name:"></asp:Label>
                                            </td>
                                            <td class="auto-style4">

                                                <telerik:RadTextBox ID="txtCustomerLName" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label4" runat="server" Text="Address:"></asp:Label>
                                            </td>
                                            <td class="auto-style4">

                                                <telerik:RadTextBox ID="txtCustomerAddress" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label5" runat="server" Text="City:"></asp:Label>
                                            </td>
                                            <td class="auto-style4">
                                                <telerik:RadTextBox ID="txtCustomerCity" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label6" runat="server" Text="State:"></asp:Label>
                                            </td>
                                            <td class="auto-style4">
                                                <telerik:RadTextBox ID="txtCustomerState" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label7" runat="server" Text="ZipCode:"></asp:Label>
                                            </td>
                                            <td class="auto-style4">
                                                <telerik:RadTextBox ID="txtCustomerZipCode" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label8" runat="server" Text="Phone Number:"></asp:Label>
                                            </td>
                                            <td class="auto-style4">
                                                <telerik:RadTextBox ID="txtCustomerPhoneNumber" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label9" runat="server" Text="Email:"></asp:Label>
                                            </td>
                                            <td class="auto-style4">
                                                <telerik:RadTextBox ID="txtCustomerEmail" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </fieldset>
                            </td>
                            <td style="width: 40%">
                                <fieldset style="width: 80%; background: white; margin-top: -30px; margin-left: 100px">
                                    <legend>
                                        <asp:Label ID="Label10" runat="server" Text="Shipping Info" Font-Size="Large"></asp:Label></legend>
                                    <table style="width: 100%">
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label11" runat="server" Text="F.Name:"></asp:Label>
                                            </td>
                                            <td>

                                                <telerik:RadTextBox ID="txtShipFName" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label12" runat="server" Text="L.Name:"></asp:Label>
                                            </td>
                                            <td>

                                                <telerik:RadTextBox ID="txtShipLName" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label13" runat="server" Text="Address:"></asp:Label>
                                            </td>
                                            <td>

                                                <telerik:RadTextBox ID="txtShipAddress" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label14" runat="server" Text="City:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtShipCity" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label15" runat="server" Text="State:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtShipState" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label16" runat="server" Text="ZipCode:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtShipZipCode" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label17" runat="server" Text="Phone Number:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtShipPhone" runat="server" Width="100%" Skin="Metro">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </fieldset>
                            </td>
                        </tr>
                        <tr>
                            <td class="auto-style2">
                                <fieldset style="width: 100%; background: white">
                                    <legend>
                                        <asp:Label ID="Label18" runat="server" Text="Other Info" Font-Size="Large"></asp:Label></legend>
                                    <table>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label19" runat="server" Text="Total Weight:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtTotalWeight" runat="server" Width="100%" Skin="Metro" Enabled="False">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label20" runat="server" Text="Total Money:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtTotalMoney" runat="server" Width="100%" Skin="Metro" Enabled="False">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label21" runat="server" Text="Scret Number:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtScretNumber" runat="server" Width="100%" Skin="Metro" Enabled="False">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label25" runat="server" Text="Employee Name:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtEmpName" runat="server" Width="100%" Skin="Metro" Enabled="False">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label26" runat="server" Text="Item Details:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtItemDetails" runat="server" Width="100%" Skin="Metro" Height="117px" Style="margin-bottom: 0px" TextMode="MultiLine">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label22" runat="server" Text="Active:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadButton ID="btnYes" runat="server" ToggleType="Radio" ButtonType="ToggleButton"
                                                    GroupName="Radios" AutoPostBack="false">
                                                    <ToggleStates>
                                                        <telerik:RadButtonToggleState Text="Yes"></telerik:RadButtonToggleState>
                                                        <telerik:RadButtonToggleState Text="Yes"></telerik:RadButtonToggleState>
                                                    </ToggleStates>
                                                </telerik:RadButton>
                                                <telerik:RadButton ID="btnNo" runat="server" ToggleType="Radio" ButtonType="ToggleButton"
                                                    GroupName="Radios" AutoPostBack="false">
                                                    <ToggleStates>
                                                        <telerik:RadButtonToggleState Text="No"></telerik:RadButtonToggleState>
                                                        <telerik:RadButtonToggleState Text="No"></telerik:RadButtonToggleState>
                                                    </ToggleStates>
                                                </telerik:RadButton>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20%">
                                                <asp:Label ID="Label23" runat="server" Text="Created Time:"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtCreatedTime" runat="server" Width="100%" Skin="Metro" Enabled="False">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>

                                    </table>
                                </fieldset>
                            </td>
                            <td style="width: 40%; vertical-align: top">
                                <fieldset style="width: 80%; margin-left: 100px; background: white">
                                    <legend>
                                        <asp:Label ID="Label24" runat="server" Text="Tracking Status" Font-Size="Large"></asp:Label></legend>
                                    <telerik:RadGrid ID="RadGrid2" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" GridLines="None" OnInsertCommand="RadGrid2_InsertCommand" OnItemCommand="RadGrid2_ItemCommand" OnItemDataBound="RadGrid2_ItemDataBound" Skin="Hay" AutoGenerateEditColumn="True" OnUpdateCommand="RadGrid2_UpdateCommand">
                                        <ClientSettings>
                                            <Selecting AllowRowSelect="True" />
                                            <Resizing AllowColumnResize="True" AllowResizeToFit="True" AllowRowResize="True" />
                                        </ClientSettings>
                                        <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="TopAndBottom">
                                            <CommandItemSettings ExportToPdfText="Export to PDF" />
                                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                                                <HeaderStyle Width="20px" />
                                            </RowIndicatorColumn>
                                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                                <HeaderStyle Width="20px" />
                                            </ExpandCollapseColumn>
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="ID" FilterControlAltText="Filter ID column" HeaderText="ID" SortExpression="ID" UniqueName="ID" Visible="False" EditFormHeaderTextFormat="">
                                                    <ColumnValidationSettings>
                                                        <ModelErrorMessage Text="" />
                                                    </ColumnValidationSettings>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="DeliveryMasterID" FilterControlAltText="Filter DeliveryMasterID column" HeaderText="DeliveryMasterID" SortExpression="DeliveryMasterID" UniqueName="DeliveryMasterID" Visible="False" EditFormHeaderTextFormat="">
                                                    <ColumnValidationSettings>
                                                        <ModelErrorMessage Text="" />
                                                    </ColumnValidationSettings>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="DeliveryStatus" FilterControlAltText="Filter DeliveryStatus column" HeaderText="Delivery Status" SortExpression="DeliveryStatus" UniqueName="DeliveryStatus">
                                                    <ColumnValidationSettings>
                                                        <ModelErrorMessage Text="" />
                                                    </ColumnValidationSettings>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridDateTimeColumn DataField="CreatedTime" FilterControlAltText="Filter CreatedTime column" HeaderText="Created Time" SortExpression="CreatedTime" UniqueName="CreatedTime" EditFormHeaderTextFormat="">
                                                    <ColumnValidationSettings>
                                                        <ModelErrorMessage Text="" />
                                                    </ColumnValidationSettings>
                                                </telerik:GridDateTimeColumn>
                                            </Columns>
                                            <EditFormSettings>
                                                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                </EditColumn>
                                            </EditFormSettings>
                                            <EditItemStyle BackColor="LightGreen" />
                                            <PagerStyle PageSizeControlType="RadComboBox" />
                                        </MasterTableView>
                                        <PagerStyle PageSizeControlType="RadComboBox" />
                                        <FilterMenu EnableImageSprites="False">
                                        </FilterMenu>
                                    </telerik:RadGrid>

                                </fieldset>
                            </td>
                        </tr>
                    </table>
                    <br />
                     <Center><telerik:RadButton ID="btnUpdate" OnClick="btnUpdate_Click" AutoPostBack="true" Skin="Metro" Width="300px" runat="server" Text="Update Info"></telerik:RadButton></Center>
                </telerik:RadAjaxPanel>
            </telerik:RadAjaxPanel>

            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
            </telerik:RadAjaxLoadingPanel>
        </div>
</asp:Content>
